/*
 * @Author: c.k
 * @Date: 2019-04-02 13:36:33 
 * @Last Modified by: c.k
 * @Last Modified time: 2019-04-02 15:02:03
 */


import Url from './url';
import Service from './service';
 // 接口前缀名称
 const apiProfix = '/cpapis/';

export default {
  install(Vue) {
    let api = {};
    for (let u of Url) {
      let methods = u.methods || 'post';
      // 所有接口前缀
      api[u.name] = data => Service[methods](apiProfix + u.url, data);
    }
    Vue.prototype.$api = api;
    Vue.$api = api;
  }
};
